#include<iostream>
using namespace std;

int main()
{
    int x, n, S = 0;
    scanf("%d%d", &x, &n);
    while (n)
    {
        n--;
        if (x == 6)
        {
            x++;
            continue;
        }
        if (x == 7) {
            x = 1;
            continue;
        }
        S += 250, x++;
    }
    cout << S << endl << endl;
    return 0;
}